home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / dev / ds3100.md / devFsOpTable.c < prev    next >
C/C++ Source or Header  |  1990-10-19  |  5KB  |  174 lines

  1. /* 
  2.  * devFsOpTable.c --
  3.  *
  4.  *    The operation tables for the file system devices.  
  5.  *
  6.  *    Copyright (C) 1989 Digital Equipment Corporation.
  7.  *    Permission to use, copy, modify, and distribute this software and
  8.  *    its documentation for any purpose and without fee is hereby granted,
  9.  *    provided that the above copyright notice appears in all copies.  
  10.  *    Digital Equipment Corporation makes no representations about the
  11.  *    suitability of this software for any purpose.  It is provided "as is"
  12.  *    without express or implied warranty.
  13.  */
  14.  
  15. #ifndef lint
  16. static char rcsid[] = "$Header: /sprite/src/kernel/dev/ds3100.md/RCS/devFsOpTable.c,v 9.4 90/10/19 15:40:18 mgbaker Exp $ SPRITE (Berkeley)";
  17. #endif not lint
  18.  
  19.  
  20. #include "sprite.h"
  21. #include "dev.h"
  22. #include "devInt.h"
  23. #include "fs.h"
  24. #include "rawBlockDev.h"
  25. #include "devFsOpTable.h"
  26. #include "devTypes.h"
  27.  
  28. /*
  29.  * Device specific include files.
  30.  */
  31.  
  32. #include "devSyslog.h"
  33. #include "devNull.h"
  34. #include "devSCSIDisk.h"
  35. #include "devSCSITape.h"
  36. #include "devNet.h"
  37. #include "devBlockDevice.h"
  38. #include "scsiHBADevice.h"
  39. #include "raidExt.h"
  40. #include "tty.h"
  41. #include "graphics.h"
  42.  
  43. static ReturnStatus NoDevice();
  44. static ReturnStatus NullProc();
  45.  
  46. #ifdef SERIALB_DEBUG
  47. extern ReturnStatus Dev_serialBOutTrace();
  48. extern ReturnStatus Dev_serialBInTrace();
  49. #endif
  50.  
  51.  
  52. /*
  53.  * Device type specific routine table:
  54.  *    This is for the file-like operations as they apply to devices.
  55.  *    DeviceOpen
  56.  *    DeviceRead
  57.  *    DeviceWrite
  58.  *    DeviceIOControl
  59.  *    DeviceClose
  60.  *    DeviceSelect
  61.  *    DeviceMMap
  62.  */
  63.  
  64.  
  65. DevFsTypeOps devFsOpTable[] = {
  66.     /*
  67.      * Serial lines used to implement terminals.
  68.      */
  69.     {DEV_TERM,       DevTtyOpen, DevTtyRead, DevTtyWrite,
  70.              DevTtyIOControl, DevTtyClose, DevTtySelect,
  71.              DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  72.     /*
  73.      * The system error log.  If this is not open then error messages go
  74.      * to the console.
  75.      */
  76.     {DEV_SYSLOG,    Dev_SyslogOpen, Dev_SyslogRead, Dev_SyslogWrite,
  77.             Dev_SyslogIOControl, Dev_SyslogClose, Dev_SyslogSelect,
  78.             DEV_NO_ATTACH_PROC, Dev_SyslogReopen, NullProc},
  79.     /*
  80.      * SCSI Worm interface.
  81.      */
  82.     {DEV_SCSI_WORM, NoDevice, NullProc, NullProc,
  83.             NullProc, NullProc, NullProc, 
  84.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  85.     /*
  86.      * The following device number is unused.
  87.      */
  88.     {DEV_PLACEHOLDER_2, NoDevice, NullProc, NullProc,
  89.             NullProc, NullProc, NullProc, 
  90.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  91.     /*
  92.      * New SCSI Disk interface.
  93.      */
  94.     {DEV_SCSI_DISK, DevRawBlockDevOpen, DevRawBlockDevRead,
  95.             DevRawBlockDevWrite, DevRawBlockDevIOControl, 
  96.             DevRawBlockDevClose, Dev_NullSelect, DevScsiDiskAttach,
  97.             DevRawBlockDevReopen, NullProc},
  98.     /*
  99.      * SCSI Tape interface.
  100.      */
  101.     {DEV_SCSI_TAPE, DevSCSITapeOpen, DevSCSITapeRead, DevSCSITapeWrite,
  102.             DevSCSITapeIOControl, DevSCSITapeClose, Dev_NullSelect,
  103.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  104.     /*
  105.      * /dev/null
  106.      */
  107.     {DEV_MEMORY,    NullProc, Dev_NullRead, Dev_NullWrite,
  108.             Dev_NullIOControl, NullProc, Dev_NullSelect,
  109.             DEV_NO_ATTACH_PROC, NullProc, NullProc},
  110.     /*
  111.      * Xylogics 450 disk controller.
  112.      */
  113.     {DEV_XYLOGICS, NullProc, Dev_NullRead, 
  114.            Dev_NullWrite, Dev_NullIOControl, 
  115.            NullProc, Dev_NullSelect, 
  116.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  117.     /*
  118.      * Network devices.  The unit number specifies the ethernet protocol number.
  119.      */
  120.     {DEV_NET,      DevNet_FsOpen, DevNet_FsRead, DevNet_FsWrite, 
  121.            DevNet_FsIOControl, DevNet_FsClose, DevNet_FsSelect,
  122.            DEV_NO_ATTACH_PROC, DevNet_FsReopen, NullProc},
  123.     /*
  124.      * Raw SCSI HBA interface.
  125.      */
  126.     {DEV_SCSI_HBA, DevSCSIDeviceOpen, Dev_NullRead, Dev_NullWrite,
  127.                     DevSCSIDeviceIOControl, DevSCSIDeviceClose, Dev_NullSelect,
  128.                     DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  129.     /*
  130.      * RAID device.
  131.      */
  132.     {DEV_RAID, NullProc, Dev_NullRead,
  133.            Dev_NullWrite, Dev_NullIOControl,
  134.            NullProc, Dev_NullSelect,
  135.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  136.  
  137.     /*
  138.      * Debug device. (useful for debugging RAID device)
  139.      */
  140.     {DEV_DEBUG, NullProc, Dev_NullRead,
  141.            Dev_NullWrite, Dev_NullIOControl,
  142.            NullProc, Dev_NullSelect,
  143.            DEV_NO_ATTACH_PROC, NullProc, NullProc},
  144.  
  145.     /*
  146.      * The graphics device.
  147.      */
  148.     {DEV_MOUSE, DevGraphicsOpen, DevGraphicsRead, DevGraphicsWrite,
  149.            DevGraphicsIOControl, DevGraphicsClose, DevGraphicsSelect,
  150.            DEV_NO_ATTACH_PROC, NoDevice, NullProc}, 
  151.     /*
  152.      * The following device number is unused.
  153.      */
  154.     {DEV_PLACEHOLDER_3, NoDevice, NullProc, NullProc,
  155.             NullProc, NullProc, NullProc, 
  156.             DEV_NO_ATTACH_PROC, NoDevice, NullProc},
  157. };
  158.  
  159. int devNumDevices = sizeof(devFsOpTable) / sizeof(DevFsTypeOps);
  160.  
  161.  
  162. static ReturnStatus
  163. NullProc()
  164. {
  165.     return(SUCCESS);
  166. }
  167.  
  168.  
  169. static ReturnStatus
  170. NoDevice()
  171. {
  172.     return(FS_INVALID_ARG);
  173. }
  174.